#pragma once
//helpers for definition of new exception types
#include <exception>
#include <string>

#define EXCEPTION( NEW_CLASS_NAME, MSG )								\
class NEW_CLASS_NAME: public std::exception {							\
public:																	\
	NEW_CLASS_NAME() : _altMsg(MSG) {}									\
	~NEW_CLASS_NAME() throw() {}										\
	NEW_CLASS_NAME( const char *altMsg ) : _altMsg(altMsg) {}			\
	NEW_CLASS_NAME( const std::string &altMsg ) : _altMsg(altMsg) {}	\
	NEW_CLASS_NAME & append(const std::string &app) throw()				\
		{ _altMsg += ": "; _altMsg += app; return *this; }				\
	NEW_CLASS_NAME & append0(const std::string &app) throw()			\
		{ _altMsg += app; return *this; }								\
	const char * what() const throw() {									\
		return _altMsg.c_str();											\
	}																	\
protected:																\
	std::string _altMsg;												\
};
